#ifndef __I264E_RATECONTROL_H__
#define __I264E_RATECONTROL_H__

#include <jzm_enc_api_t21.h>

typedef struct {
    uint32_t    pred_mad;;
	uint32_t    actual_bits;
	uint32_t    mb_inter_cnt;
	uint32_t    mb_inter_mv;
	uint64_t    frame_sse;
	uint32_t    u32CrpRgnc[8];
	uint32_t    u32SasCnt[3];
	uint32_t    mv_range[8];
	uint32_t    intra_weight[8];
	int32_t     glb_mvx_sum;
	int32_t     glb_mvy_sum;
	uint32_t    glb_mv_cnt;
	uint32_t    qpg_rgnc[4];
    struct frm_link_container frmLink;
    uint32_t    frm_i4Cnt;
    uint32_t    frm_i8Cnt;
    uint32_t    frm_i16Cnt;
} i264e_rc_middata_t;

extern int i264e_ratecontrol_priv_init(i264e_t *h, void **priv, int *priv_size);
extern void i264e_ratecontrol_priv_deinit(i264e_t *h, void *priv, int priv_size);
extern int i264e_ratecontrol_init(i264e_t *h, int initQp);
extern int i264e_ratecontrolfile_init(i264e_t *h, int initQp);
extern int i264e_ratecontrol_start(i264e_thread_t *t);
extern int i264e_ratecontrol_is_reenc(i264e_thread_t *t);
extern int i264e_ratecontrol_is_reenc_end(i264e_thread_t *t);
extern int i264e_ratecontrol_is_larger_lastidr(i264e_thread_t *t);
extern int i264e_ratecontrol_end(i264e_thread_t *t);
extern void i264e_ratecontrol_deinit(i264e_t *h);
extern int i264e_analyze_rcfile_param(FILE *fp, char *linebuf, char *tmpbuf1, char *tmpbuf2, RC_CFG_S_T21 *cfg);

#endif
